#include "LinearEqu.h"	
#include <iostream>
using namespace std;





int main() {

/*	double m[7];
	double n[7];
	for (int i = 0; i < 7; i++)
	{
		cout << "please input the T"<<i << endl;

		cin >> m[i];
	}
	for (int i = 0; i < 7; i++)
	{
		cout << "please input the R" << i << endl;

		cin >> m[i];
	}
	for (int i = 0; i < 7; i++)
	{
		cout <<m[i] << endl;

	}*/
	double m[] = {
	19.1,
	25.0,
	30.1,
	36.0,
	40.0,
	45.6,
	50.0,
	};
	double n[] = { 
		76.30,
		77.80,
		79.25,
		80.80,
		82.35,
		83.90,
		85.10
	};
	double a[4];
	double b[2];
	double j[42] = {0};
	double k[42] = {0};
	int hhh = 0;

	for (int y = 0; y < 7; y++)
	{
		for (int x = y; x < 7; x++)
		{
			if (x != y)
			{
				a[0] = m[y];
				a[2] = m[x];
				a[1] = 1.0;
				a[3] = 1.0;


				b[0] = n[y];
				b[1] = n[x];

				LinearEqu equ(2);
				equ.setLinearEqu(a, b);
				equ.printLinearEqu();
				if (equ.solve())
				{
					equ.printSolution(hhh,j,k);
					cout << "                     " << endl;
					hhh++;
				}
				else
					cout << "Fail" << endl;
			}
			else
				continue;
		}
	}
	cout << hhh << endl;

	double sumj=0, sumk=0;

	for (int l = 0; l < 21; l++)
		sumj += j[l];
	sumj = sumj / 21;

	cout << endl;
	cout << endl;

	for (int l = 0; l < 21; l++)
		sumk += k[l];
	sumk = sumk / 21;

	cout <<"a1 is " << sumj << endl;
	cout <<"a0 is" << sumk << endl;

}